<?php $this->load->view('inc/header'); ?>
<?php
	//Get Numrows Count Entry of category
	$this->db->where('blog_author',$id);
	$query2 = $this->db->get('blog');
	$entry_count = $query2->num_rows();
?>
<!--one colunm-->
<div class="grid_12" style="background-color:#CCCCCC; padding-top:20px; padding-bottom:15px;">
<div class="grid_12 alpha" id="one_cols1">
	<div id="topic" style="position:relative;">My Blogs.
    </div>
</div>


<div class="grid_12 alpha"  id="one_cols2">
<div style="padding-left:15px;">
<div id="summary_blog" style="-moz-border-radius-topleft: 3px;
-moz-border-radius-topright: 3px;
-moz-border-radius-bottomright: 3px;
-moz-border-radius-bottomleft: 3px;
border-top-left-radius: 3px;
border-top-right-radius: 3px;
border-bottom-right-radius: 3px;
border-bottom-left-radius: 3px; background:#9B4E00; width:870px; padding:3px; color:#FFFFFF; font-size:small;">Count of blog <?=$entry_count?> Blogs.</div>
<br/>
<style>
  table {
    background:#AAD5D5;
	-moz-border-radius-topleft: 3px;
	-moz-border-radius-topright: 3px;
	-moz-border-radius-bottomright: 3px;
	-moz-border-radius-bottomleft: 3px;
	border-top-left-radius: 3px;
	border-top-right-radius: 3px;
	border-bottom-right-radius: 3px;
	border-bottom-left-radius: 3px; 	
  }
  .oddCSS{
  	background:#5FAFAF;
  	-moz-border-radius-topleft: 3px;
	-moz-border-radius-topright: 3px;
	-moz-border-radius-bottomright: 3px;
	-moz-border-radius-bottomleft: 3px;
	border-top-left-radius: 3px;
	border-top-right-radius: 3px;
	border-bottom-right-radius: 3px;
	border-bottom-left-radius: 3px; 
  }
</style>
	<div id="list_entry">
    	<table border="0" width="875" cellpadding="1" cellspacing="1">
		<?php
			$this->db->order_by('blog_id','desc');
			$this->db->join('membership','membership.member_id=blog.blog_author');
			$this->db->where('blog_author',$id);
			$query = $this->db->get('blog');
			
			$count = 0;
			
			foreach($query->result() as $rows){
				/*count*/
				$count++;
				
				/*blog tables*/
				$blog_id = $rows->blog_id;
				$blog_entry_name = $rows->blog_entry_name;
				$blog_content = $rows->blog_content;
				$blog_create_date = $rows->blog_create_date;
				
				/*memberahip tables*/
				$member_id = $rows->member_id;
				$firstname = $rows->firstname;
				$lastname = $rows->lastname;
				$nickname = $rows->nickname;
				$member_display = $rows->member_display;
		?>
        <tr>
            <td>
                <div id="view_entry" style="padding:5px;">
                	<div id="member_avatar" style="position:relative;">
                    <?php
                    	if($member_display == NULL)
                        {
                     ?>
                            <div id="avatar"><img src="<?=base_url()?>km_resource/member_display/null.png" width="60" height="60"/></div>
                    <?php
                        }
                        else
                        {
                     ?>
                            <div id="avatar"><img src="<?=base_url()?>km_resource/member_display/<?=$member_display?>" width="60" height="60"/></div>
                    <?php
                        }
                    ?>
                    	<div id="entry_name" style="position:absolute; left:80px; top:1px; font-size:small;"><a href="<?=base_url()?>blog/<?=$nickname?>/entry/<?=$blog_id?>"><?=word_limiter($blog_entry_name,50)?></a>&nbsp;<a href="<?=base_url()?>blog/<?=$nickname?>/edit/entry_id/<?=$blog_id?>"><img src="<?=base_url()?>images/graphic/pencil.png"/></a>&nbsp;<a href="<?=base_url()?>blog/<?=$nickname?>/delete/entry_id/<?=$blog_id?>"><img src="<?=base_url()?>images/graphic/eraser.png"/></a></div>
                        <div id="entry_content" style="position:absolute; left:80px; top:30px; font-size:10px;">วันที่ <?php $d = mysql_to_unix($blog_create_date); echo unix_to_human($d); ?></div>
                        <div id="author" style="position:absolute; left:80px; top:45px; font-size:11px;">โดย <?=$firstname?> <?=$lastname?>&nbsp;(<?=$nickname?>)</div>
                        <?php
							if($count==1){
						?>
                        <div id="badge" style="position:absolute; right:50px; top:5px;"><img src="<?=base_url()?>images/graphic/1291736406_splash_new_orange.png"/></div>
                        <?php
						}
						?>
                    </div>                    
                </div>
            </td>
        </tr>
        
        <?php		
			}
		?>
        </table>
    </div>
    <script>$("tr:odd").addClass('oddCSS');</script>
</div>
</div>
<div class="grid_12 alpha" id="one_cols3"></div>
</div>
<div class="clear"></div>
<!--end one column-->

<?php $this->load->view('inc/footer'); ?>